DEX也是香港中文大學發展的,它建立在SurRoL之上,跟SurRoL一樣,如果沒用dVRK硬體,不須裝dVRK.但他是用pytorch而非tensorflow
git clone --recursive https://github.com/med-air/DEX.git
cd DEX
conda create -n dex python=3.8
conda activate dex
cd SurRoL
pip3 install click #缺這
pip3 install -e .
# pip3 install -e SurRoL/ # install surrol environments
pip3 install -r requirements.txt #torch不是tensorflow
pip3 install -e .
然後要在anaconda3/envs/dex/lib/python3.8/site-packages/gym/envs/init.py加入一行(不知道網頁為何重複2次gym)
import surrol.gym
範例是
mkdir SurRoL/surrol/data/demo
python SurRoL/surrol/data/data_generation.py --env NeedlePick-v0
如果要項網頁上自己訓練看看,須先把~/DEX/dex/configs/traing.yaml中的第27行的entity_name: thuang22改成自己在wandb.ai中的名子,然後再執行training. 而~/DEX/dex/configs/eval.yaml也是
#Train DDPG with 4 parallel training processes:
start=$(date "+%s")
#do something
mpirun -np 4 python -m train agent=ddpg task=NeedlePick-v0 use_wb=True #device=cpu
now=$(date "+%s")
time=$((now-start))
echo " DDPG with 4 parallel training processes training time used:$time seconds" >> ./output
效果沒有demo的好
python3 ~/DEX/eval.py task=NeedlePick-v0 agent=ddpg ckpt_episode=~/DEX/exp_local/NeedlePick-v0/DDPG/d100/s1/model/weights_ep1600.pth
p.s.裝完DEX,在DEX/SurRoL/surrol/tasks/下的都可以跑,不用裝SurRoL
p.s.2 剛開始沒有GPU卡,我無法跑訓練,會出現failed to EGL with glad.我有請教作者,他說可以試試加上 device=cpu,但我發覺沒用.只好買一張rtx 4060,而且CUDA,cuDNN好難裝